<?php
namespace Home\Service;

/**
 * FeedbackService
 */
class FeedbackService extends CommonService {
    /**
     *删除投票信息
     *@return
     */
    public function delete($id) {
        $Feedback = $this->getD();
        
        $Feedback->startTrans();
        $delstate = $Feedback->delete($id);
        if (false === $delstate) {
            $Feedback->rollback();
            return $this->resultReturn(false);
        }
        $Feedback->commit();
        
        return $this->resultReturn(true);
    }
    
    /**
     * 是否存在投票
     * @param  int     $id 投票id
     * @return boolean
     */
    public function existFeedback($id) {
        return !is_null($this->getM()->getById($id));
    }

    protected function getModelName() {
        return 'Feedback';
    }
}
